<?php
	if(isset($_REQUEST['nomCal'])) { //AJOUTER DES VERIFICATIONS (regex) !
		$nomCal = $_REQUEST['nomCal'];
		$idCrea = $_SESSION['id'];
		$idcal = DB::select("insert into agenda_calendrier values(DEFAULT, '$nomCal', $idCrea) returning idcalendrier");
		$idcal = $idcal[0]->idcalendrier;
		//AJOUTER TOUS LES DROITS AU CREATEUR :
		$nbdroit = count(DB::select("select iddroit from agenda_droit"));
		for($i=0; $i < $nbdroit; $i++)
			DB::maj("insert into agenda_lienutilcaldroit values($idCrea, $idcal, $i)");
	}
?>

<form method="post">
	Cr&eacute;er un agenda :
	<input name="nomCal" value="Nom agenda" onfocus="if(this.value == 'Nom agenda') { this.value = ''; }" onblur="if(this.value == '') { this.value = 'Nom agenda'; }">
	<input name="connexion" value="Cr&eacute;er" type="submit">
</form>